<div class="db_left bl">
    <?php $this->load->view('site/user/side_block'); ?>
</div>
    <div class="db_right bl">
        <div class="std_header auto_height">
            <div class="left">
                <strong>Thông tin người dùng</strong>
            </div>
        </div>
        <div id="user_management">
            <form id="frm_user_edit" enctype="multipart/form-data" method="POST" action="<?php echo $save_action; ?>">
                <?php $this->load->view('site/user/message'); ?>
                <input id="entity_id" type="hidden" name="id" value="<?php echo isset($user->id) ? $user->id : '' ; ?>" />
                <div class="clearfix auto_height mb_10 mt_10">
                    <button class="gray_btn " type="button" onclick="window.location = '<?php echo site_url('admin/site/user/index', true); ?>'"><span>Về danh sách</span></button>
                    <button class="gray_btn" type="submit" ><span>Lưu lại</span></button>
                    <button class="gray_btn" type="reset"><span>Nhập lại</span></button>
                    <?php if (isset($user->id) && $has_privilege_delete) :?>
                    <button class="gray_btn delete_btn" type="button" action="<?php echo site_url('admin/site/user/delete/id/' . $user->id, true); ?>" message="Bạn muốn xóa khoa này?" onclick="btn_util.active_delete(this)"><span>Xóa khoa</span></button>
                    <?php endif; ?>
                </div>
                <div class="form_block">
                    <div class="block_header">
                        Thông tin cơ bản
                    </div>
                    <div class="block_content">
                        <table cellpadding="0px" cellspacing="0px">
                            <tr>
                                <td class="frm_label">Tên đăng nhập</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input required" name="data[username]" title="Tên đăng không được để trống" value="<?php echo get_field($user, 'username'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Password</td>
                                <td class="frm_field">
                                    <input type="password" class="std_input" name="data[password]" title="Mật khẩu " />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Tên đầy đủ</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="Tên đầy đủ" name="data[fullname]"  value="<?php echo get_field($user, 'alter_name'); ?>" />
                                </td>
                            </tr>

                            <tr>
                                <td class="frm_label">Avatar</td>
                                <td class="frm_field">
                                    <?php $image = get_field($user, 'avatar'); ?>
                                    <?php if (!empty($image)) :?>
                                    <a target="_blank" href="<?php echo render_src($image); ?>"><img src="<?php echo render_src($image); ?>" width="40px" style="vertical-align: middle; border: 2px solid #bbb" /></a>
                                    <?php endif; ?>
                                    <input type="file" name="data_image" />
                                    &nbsp;
                                    <input onclick="return admin_user.show_img_path(this.checked)" style="top: 2px; position: relative" type="checkbox" name="set_img_url" id="set_img_url" value="1" />
                                    <label for="set_img_url">Chọn đường dẫn ảnh</label>
                                    <div class="clearfix mt_10" id="wp_img_path" style="display: none">
                                        <input name="img_path" type="text" class="std_input" value="<?php echo $image; ?>" />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Loại thành viên</td>
                                <td class="frm_field">
                                    <select class="std_input" name="data[user_type]">
                                        <option value="1" <?php if (isset($user->user_type) && $user->user_type == 1) :?> selected="selected" <?php endif; ?>>Tra cứu</option>
                                        <option value="2" <?php if (isset($user->user_type) && $user->user_type == 2) :?> selected="selected" <?php endif; ?>>Nghiên cứu</option>
                                        <option value="3" <?php if (isset($user->user_type) && $user->user_type == 3) :?> selected="selected" <?php endif; ?>>Chuyên gia</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Email</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="email" name="data[email]"  value="<?php echo get_field($user, 'email'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Điện thoại</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="Số điện thoại" name="data[phone]"  value="<?php echo get_field($user, 'phone'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Điện thoại bàn</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="Điện thoại bàn" name="data[home_phone]"  value="<?php echo get_field($user, 'home_phone'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Yahoo</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="Yahoo" name="data[yahoo]"  value="<?php echo get_field($user, 'yahoo'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Facebook</td>
                                <td class="frm_field">
                                    <input type="text" class="std_input" title="Facebook" name="data[facebook]"  value="<?php echo get_field($user, 'facebook'); ?>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Địa chỉ</td>
                                <td class="frm_field">
                                    <textarea rows="" cols="" name="data[address]" title="Địa chỉ"><?php echo get_field($user, 'address'); ?></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="frm_label">Kích hoạt</td>
                                <td class="frm_field">
                                    <select class="std_input" name="data[is_active]">
                                        <option value="1" <?php if (isset($user->is_active) && $user->is_active == 1) :?> selected="selected" <?php endif; ?>>Chưa kích hoạt</option>
                                        <option value="2" <?php if (isset($user->is_active) && $user->is_active == 2) :?> selected="selected" <?php endif; ?>>Đã kích hoạt</option>
                                    </select>
                                </td>
                            </tr>

                        </table>
                    </div>
                </div>

                <div class="clearfix auto_height mb_10">
                    <button class="gray_btn " type="button" onclick="window.location = '<?php echo site_url('admin/site/user/index', true); ?>'"><span>Về danh sách</span></button>
                    <button class="gray_btn" type="submit" ><span>Lưu lại</span></button>
                    <button class="gray_btn" type="reset"><span>Nhập lại</span></button>
                    <?php if (isset($user->id) && $has_privilege_delete) :?>
                    <button class="gray_btn delete_btn" type="button" action="<?php echo site_url('admin/site/user/delete/id/' . $user->id, true); ?>" message="Bạn muốn xóa thành viên này?" onclick="btn_util.active_delete(this)"><span>Xóa thành viên</span></button>
                    <?php endif; ?>
                </div>
            </form>
        </div>
    </div>


<div class="clearfix"></div>
<script type="text/javascript" src="<?php echo BASE_URL; ?>js/admin/user/function.js"></script>
<script type="text/javascript">
    $("#frm_user_edit").validate({
        errorLabelContainer: $("#form_error")
    });
</script>
